home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 1168 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.7 KB

  1. From: "Felix I. Wyss" <fwyss@linx.co.uk>
  2. Message-ID: <199604191448.PAA01868@bowmore.linx.co.uk>
  3. X-Original-Date: Fri, 19 Apr 1996 15:46:39 +0100
  4. Path: in1.uu.net!bounce-back
  5. Date: 19 Apr 96 15:01:35 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Organization: -
  8. Newsgroups: comp.std.c++
  9. X-Sender: fwyss@bowmore
  10. X-Mailer: Windows Eudora Light Version 1.5.2
  11. Content-Type: text/plain; charset="us-ascii"
  12. Subject: Check whether object has been allocated on heap
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBFAgUBMXeq7eEDnX0m9pzZAQEjvQF9FYZq1hEmYrbxUAJn/oDqtVDybvk4pLbE
  15.     F9MaXAqiJuj/UUfQl1KzTNpYBp69OJuj
  16.     =3xYJ
  17.  
  18. Hello folks!
  19.  
  20. I'm sure this question has been asked many times but here is it anyway:
  21.  
  22. How can I determine whether an object has been instantiated by allocating
  23. heap space ("new") or whether it is global/static/automatic or even a member
  24. of an other object.
  25. In other words: does a particular object have to be destroyed by calling
  26. "delete" or not. 
  27. Is there a proper (and portable) way to do determine that or is there a
  28. proposal for the new C++ standard to achieve this functionality?
  29. If not, what's about a function "is_dynamic(x)" (where 'x' is a pointer to
  30. an object) that returns 1 for dynamically allocated objects and 0 in all
  31. other cases.
  32.  
  33. I often came across situations where this information would have been very
  34. useful. 
  35.  
  36. Thank you for your attention!
  37.  
  38. Felix (fwyss@linx.co.uk)
  39. ---
  40. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  41. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  42. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  43. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  44. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  45.